package com.example.classconnect;

import static android.provider.BaseColumns._ID;
import static com.example.classconnect.DBVariables.EMAIL;
import static com.example.classconnect.DBVariables.FNAME;
import static com.example.classconnect.DBVariables.LNAME;
import static com.example.classconnect.DBVariables.PWORD;
import static com.example.classconnect.DBVariables.TABLE_NAME;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class UserData extends SQLiteOpenHelper {
	private static final String DATABASE_NAME = "ClassConnect.db";
	private static final int DATABASE_VERSION = 1;

	public UserData(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onCreate(SQLiteDatabase CCDB) {
		// TODO Auto-generated method stub
		CCDB.execSQL("CREATE TABLE " + TABLE_NAME + " (" + _ID
	            + " INTEGER PRIMARY KEY AUTOINCREMENT, " + FNAME
	            + " TEXT NOT NULL," + LNAME + " TEXT NOT NULL," +
	            EMAIL + " TEXT NOT NULL," + PWORD + " TEXT NOT NULL);");
	}

	@Override
	public void onUpgrade(SQLiteDatabase CCDB, int arg1, int arg2) {
		// TODO Auto-generated method stub
		CCDB.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
		onCreate(CCDB);
	}

}
